/*--------------------------------------------------------------------------------*/
#ifndef __INPUT_FILE_MANAGER__
#define __INPUT_FILE_MANAGER__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "object.h"
#include "util.h"
#include "array.h"
#include "input_file.h"
#include "map.h"
/*--------------------------------------------------------------------------------*/
#define INPUT_FILE_MANAGER_MountDirectory		INPUT_FILE_MANAGER::GetInstance().MountDirectory
#define INPUT_FILE_MANAGER_GetFile				INPUT_FILE_MANAGER::GetInstance().GetFile
#define INPUT_FILE_MANAGER_DoesFileExist		INPUT_FILE_MANAGER::GetInstance().DoesFileExist
/*--------------------------------------------------------------------------------*/
class INPUT_FILE_MANAGER : public OBJECT
{

	// -- PUBLIC

public:

    DECLARE_REF( INPUT_FILE_MANAGER );
    DECLARE_SINGLETON( INPUT_FILE_MANAGER );

    // .. CONSTRUCTORS

    INPUT_FILE_MANAGER() : OBJECT()
    {

    }

    ~INPUT_FILE_MANAGER()
    {
     
    }

    // .. METHODS

    VOID MountDirectory( const TEXT & path, const BOOL recursive = true );

    INPUT_FILE & GetFile( const TEXT & file_name )
    {
    	DEBUG_Require( FileTable.HasKey( file_name ) );

    	return * FileTable[ file_name ];
    }

    BOOL DoesFileExist( const TEXT & file_base_name ) const
    {
    	return FileTable.HasKey( file_base_name );
    }

    // -- PRIVATE

private :

    // .. ATTRIBUTES

    MAP< TEXT, INPUT_FILE::REF >
		FileTable;
};
/*--------------------------------------------------------------------------------*/
#endif
